import { createRouter, createWebHistory } from 'vue-router';
import routes from './routes';
import { getItem, setItem, removeItem } from '@/utils/storage.js';


const router = createRouter({
    history: createWebHistory(), //history模式使用HTML5模式
    routes,
    scrollBehavior(to, from, savedPosition) {
        if (savedPosition) {
            return savedPosition
        } else {
            return { top: 0 }
        }
    },
});

router.beforeEach((to, from, next) => {
    document.title = to.meta.name
    next();
})
export default router;
